import { Component, OnInit } from '@angular/core';
import {HttpClient} from "@angular/common/http";
declare var $: any;


@Component({
  selector: 'app-register',
  templateUrl: './register.component.html',
  styleUrls: ['./register.component.css']
})
export class RegisterComponent implements OnInit {

  constructor(private http: HttpClient) { }
  private id:number;
  private name:string;
  password:any;
  private confirmPassword:number;
  private samePassword:boolean=true;
  success : string ='';
  ngOnInit() {

  }


  onSubmit(){
    console.log(this.password);
    console.log(typeof +this.password);
    let body = {
      username:this.name,
      password:this.password
    };
    this.http.post('/register',body).subscribe(data=>{
     if(data['result'].status == "200"){
       alert("注册成功")
     }
    });


  }
}
